package com.eastfair.mobile.controller;

import com.eastfair.annotation.annotation.security.PreAuth;
import com.eastfair.core.base.R;
import com.eastfair.home.dto.BoothAcceptanceRecordDTO;
import com.eastfair.home.dto.BoothAcceptanceRecordQuery;
import com.eastfair.home.dto.SupervisionItemManagementQuery;
import com.eastfair.home.vo.BoothAcceptanceRecordVO;
import com.eastfair.home.vo.SupervisionItemQuestionVO;
import com.eastfair.mobile.service.MobileBoothAcceptanceRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;


/**
 * <p>
 * 前端控制器
 * 展台验收记录
 * </p>
 *
 * @author linan
 * @date 2022-11-29
 */
@Slf4j
@Validated
@RestController
@RequestMapping("/mobileBoothAcceptanceRecord")
@Api(value = "BoothAcceptanceRecord", tags = "展台验收记录")
@PreAuth(replace = "home:mobileBoothAcceptanceRecord:")
public class MobileBoothAcceptanceRecordController {

    @Resource
    private MobileBoothAcceptanceRecordService mobileBoothAcceptanceRecordService;

    /**
     * 保存展台验收明细
     * @param dto dto
     * @return R
     */
    @PostMapping(value = "/saveBoothAcceptanceDetail")
    public R<Boolean> saveBoothAcceptanceDetail(@RequestBody BoothAcceptanceRecordDTO dto){
        return mobileBoothAcceptanceRecordService.saveBoothAcceptanceDetail(dto);
    }

    /**
     * 查询展台验收记录
     * @param query query
     * @return R
     */
    @PostMapping(value = "/getBoothAcceptanceRecord")
    public R<List<BoothAcceptanceRecordVO>> getBoothAcceptanceRecord(@RequestBody BoothAcceptanceRecordQuery query){
        return mobileBoothAcceptanceRecordService.getBoothAcceptanceRecord(query);
    }

    /**
     * 查询问卷.
     * @return the r
     */
    @ApiOperation("查询问卷")
    @PostMapping("/queryQuestion")
    public R<List<SupervisionItemQuestionVO>> queryQuestion(@RequestBody SupervisionItemManagementQuery query){
        return mobileBoothAcceptanceRecordService.queryQuestion(query);
    }
}
